package com.atwulidun.yygh.task.scheduled;

import com.atwulidun.yygh.rabbit.constant.MqConst;
import com.atwulidun.yygh.rabbit.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
// 开启定时任务
@EnableScheduling
public class ScheduledTask {
    @Autowired
    private RabbitService rabbitService;

    // 每天8点执行方法，就医提醒
    // cron表达式，设置执行间隔
    // 0 0 8 * * ?
    @Scheduled(cron = "0/10 * * * * ?")
    public void taskPatient() {
        // service_order的OrderReceiver对该消息队列进行监听
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,MqConst.ROUTING_TASK_8,"");
    }
}
